package com.yc.db;

import java.io.IOException;

import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

public class TestTranstransactional {

	/**
	 * JTA(Java Transaction Architecture)标准注解
	 */
	@javax.transaction.Transactional
	public void m() {
		
	}
	
	/**
	 * spring事务注解
	 */
	@Transactional(value="transactionManger", 
			rollbackFor = Exception.class, 
			readOnly = true,
			isolation = Isolation.READ_UNCOMMITTED,//事务隔离性, 默认Isolation.DEFAULT
			propagation = Propagation.REQUIRED,//事务传播性，默认Propagation.REQUIRED
			timeout = 1000,//超时时间，单位秒，默认为-1
			noRollbackFor = IOException.class,//和rollbackFor想法，这个相当于exclude 和 include的区别
			noRollbackForClassName = {"IOException"},
			rollbackForClassName = {"IOExcetion"}
			)
	public void m2() {
		
	}
	
}
